home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1068 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  49 lines

  1. Path: rover.ucs.ualberta.ca!news
  2. From: ryangall@gpu.srv.ualberta.ca (Bobby Sixkiller)
  3. Newsgroups: comp.lang.c
  4. Subject: typedef double Poly[MAXPOLY] PROBLEM
  5. Date: 11 Jan 1996 09:32:01 GMT
  6. Organization: University of Alberta, Edmonton, Canada
  7. Message-ID: <4d2leh$14dm@pulp.ucs.ualberta.ca>
  8. NNTP-Posting-Host: async20-10.remote.ualberta.ca
  9. Mime-Version: 1.0
  10. X-Newsreader: WinVN 0.99.2
  11.  
  12.  
  13. how can I send a (pointer to Poly) to a function, and access each index 
  14. for updating?  this is my definition....its for school, and the typedef 
  15. double poly[MAXDEGREE] cannot be changed.....heres an example of one of 
  16. the functions I tried. It bails out at n=4 ...probably cause thats the 
  17. size of the pointer......it keeps crashing
  18.  
  19.  
  20. #define MAXDEGREE 200
  21.  
  22. typedef double Poly[MAXDEGREE];
  23. typedef Poly * POLY;
  24.  
  25. /* initialize the Poly P so all index's are 0 */
  26.  
  27. int initPoly(POLY P)
  28. {
  29.  int n;
  30.  for(n=0; n<MAXDEGREE; n++)
  31.  {
  32.    *P[n]=0.0;  /* can you see what Im trying to do here?!*/
  33.  }
  34.  
  35. }
  36.  
  37. int main(void)
  38. {
  39.  Poly P;
  40.  
  41.   initPoly(&P); /* initialize the polynomial */
  42.   .
  43.   .
  44.   .
  45. }
  46.  
  47. please e-mail me if you can help!  thanks!
  48.  
  49.